<header id="topbar">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="<%= window.location.href %>">活跃用户统计</a>
            </li>
        </ol>
    </div>
    <div class="topbar-right">
        <a href="#" class="btn btn-default btn-sm light fw600 ml10" id="exportData"><span class="glyphicon glyphicon-cloud-download pr5"></span>导出数据</a>
        <!--<select id="searchType" name="searchType" data-field="type">-->
            <!--<option value="recharge" <%= options.type == 'recharge' ? 'selected' : '' %>>充值top</option>-->
            <!--<option value="total_gain" <%= options.type == 'total_gain' ? 'selected' : '' %>>盈利top</option>-->
            <!--<option value="total_lost" <%= options.type == 'total_lost' ? 'selected' : '' %>>亏损top</option>-->
        <!--</select>-->
    </div>
</header>
<section id="content">
<div class="panel">
    <form class="form-horizontal">
        <div class="form-group" style="display: flex">
            <div class="col-md-11 text-center" style="width: 400px;margin: 10px 20px;">
                <span>活跃</span>
                <input type="text" id="dateFilter" name="dateFilter" class="form-control text-center" value="<%= options.dateRange[0] %> ~ <%= options.dateRange[1] %>">
            </div>
            <div class="col-md-11 text-center" style="width: 400px;margin: 10px 20px;">
                <span>注册</span>
                <input type="text" id="dateFilter2" name="dateFilter2" class="form-control text-center" value="<%= options.createRange[0] %> ~ <%= options.createRange[1] %>">
            </div>
            <% if(channels.length > 0){ %>
                    <div class="col-md-11" style="width: 400px;margin: 20px 20px;">
                        <span>渠道</span>
                        <select id="chnFilter" class="from-control" multiple>
                            <% if(options.chn == null)options.chn = []; %>
                            <% _.each(channels, function(chn){ %>
                                <option value="<%= chn %>" <%= options.chn.indexOf(chn) == -1 ? "" : "selected" %>> <%= chn || "null" %> </option>
                            <% }) %>
                        </select>
                    </div>
                <% }else{ %>
                    <label for="search" class="col-md-1 control-label">无可选渠道数据</label>
                <% } %>
            <div style="margin: 2px 20px;">
                <input type="button" id="search" class="btn btn-primary btn-block form-control" value="提交">
            </div>
        </div>
    </form>
</div>

<div class="panel overflow">
    <table class="table table-striped fs13" id="main-list">
        <thead>
            <tr class="bg-light">
                <th class="sortable" data-field="rank">排名</th>
                <th>用户ID</th>
                <th class="sortable" data-field="day">注册时间</th>
                <th>渠道号</th>
                <th class="sortable" data-field="recharge">充值金额</th>
                <th class="sortable" data-field="withdraw">提现金额</th>
                <th class="sortable" data-field="real_gain">实际盈利</th>
                <th class="sortable" data-field="pay">有效购彩</th>
                <th class="sortable" data-field="win">购彩中奖</th>
                <th class="sortable" data-field="bigbang_gain">购彩盈利</th>
                <th class="sortable" data-field="dwc_bet">电玩城参与</th>
                <th class="sortable" data-field="dwc_gain">电玩城盈利</th>
                <th class="sortable" data-field="dwc_bet">Metis参与</th>
                <th class="sortable" data-field="dwc_gain">Meits盈利</th>
                <th class="sortable" data-field="system_award">系统奖励</th>
                <th class="sortable" data-field="bet">累计参与</th>
                <th class="sortable" data-field="gain">累计盈利</th>
                <th class="sortable" data-field="gain_delta">盈亏差值</th>
            </tr>
        </thead>
        <tbody class="admin-form">
            <% _.each(items, function(item){ %>
                <tr>
                    <td><%= item.rank %></td>
                    <td><a href="#stats/account/?id=<%= item.user_id %>"><%= item.user_id %></a></td>
                    <td><%= item.registered_at  %></td>
                    <td><%= item.chn %></td>
                    <td><%= (item.recharge || 0).toFixed(2) %></td>
                    <td><%= (item.withdraw || 0).toFixed(2) %></td>
                    <td><%= (item.real_gain || 0).toFixed(2)%></td>
                    <td><%= (item.pay || 0).toFixed(2)%></td>
                    <td><%= (item.win || 0).toFixed(2)%></td>
                    <td><%= (item.bigbang_gain || 0).toFixed(2)%></td>
                    <td><%= (item.dwc_bet  || 0).toFixed(2)%></td>
                    <td><%= (item.dwc_gain  || 0).toFixed(2)%></td>
                    <td><%= (item.metis_bet || 0 ).toFixed(2) %></td>
                    <td><%= (item.metis_gain || 0 ).toFixed(2) %></td>
                    <td><%= (item.system_award || 0 ).toFixed(2) %></td>
                    <td><%= (item.bet  || 0).toFixed(2)%></td>
                    <td><%= (item.gain  || 0).toFixed(2)%></td>
                    <td><%= (item.gain_delta  || 0).toFixed(2)%></td>
                </tr>
            <% }) %>
        </tbody>
    </table>
</div>
</section>
